﻿using System;

namespace AcceptanceTests
{
    #region Domain

    [Serializable]
    public class MUODate : _MUODate
    {
        public string Do(string a, string b)
        {
            return a;
        }

        public void ControlByRefParam(ref string b)
        {
            if (b == "pouet")
            {
                b = "toto";
                return;
            }
            b = "tutu";
        }

        public string Name
        {
            get { return "pouet"; }
        }

        public bool ControlCoupling()
        {
            return IsActivated;
        }

        public string AutoProperty { get; set; }
        public bool IsActivated { get; set; }
    }

    public class Target
    {
        private readonly _MUODate muoDate;

        public Target()
            : this(new MUODate())
        {
        }

        internal Target(_MUODate muoDate)
        {
            this.muoDate = muoDate;
        }

        public string JustDoIt()
        {
            return muoDate.Do("a", "b");
        }
    }

    public interface _MUODate
    {
        string Name { get; }
        string AutoProperty { get; set; }
        bool IsActivated { get; set; }
        string Do(string a, string b);
        void ControlByRefParam(ref string b);
        bool ControlCoupling();
    }

    #endregion

    #region Not Serializable Dependency Domain

    public interface IDependency
    {
        int Get();
    }

    public interface IService
    {
        int GetResult(IDependency dependency);
    }

    public class NotSerializableDependency : IDependency
    {
        public int Get()
        {
            return 10;
        }
    }

    public class NotSerializableDependencyNotImplemented : IDependency
    {
        public int Get()
        {
            throw new NotImplementedException();
        }
    }

    [Serializable]
    public class ServiceWithNotSerializableDependencyParameter : IService
    {
        public int GetResult(IDependency dependency)
        {
            return dependency.Get();
        }
    }

    #endregion

}
